/* --- DeepSeek Inspired Styles --- */
:root {
  --background-body: #17171A;
  --background-input: #1F1F23;
  --text-primary: #E5E5E6;
  --text-secondary: #A0A0A5;
  --user-message-bg: #2A2A2E;
  --accent-blue: #4A90E2;
  --border-color: #3A3A3F;
  --font-family: "Inter", "Segoe UI", "Helvetica Neue", "Arial", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: var(--font-family);
  background-color: var(--background-body);
  color: var(--text-primary);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100%;
}

/* --- Chat Header --- */
.chat-header {
  text-align: center;
  padding-top: 1rem;
  padding-bottom: 2rem;
  flex-shrink: 0; /* Prevent header from shrinking */
}

.chat-header h1 {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text-primary);
}


/* --- Chat Container --- */
.chat-container {
  flex-grow: 1;
  min-height: 0; /* CRUCIAL FIX: Allows container to shrink and activate its own scrollbar */
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 0 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

/* Add padding to the first and last elements to avoid edges */
.chat-container > *:first-child {
  margin-top: 1rem;
}
.chat-container > *:last-child {
  margin-bottom: 2rem;
}


/* Custom Scrollbar */
.chat-container::-webkit-scrollbar {
  width: 8px;
}
.chat-container::-webkit-scrollbar-track {
  background: transparent;
}
.chat-container::-webkit-scrollbar-thumb {
  background: #3A3A3F;
  border-radius: 4px;
}
.chat-container::-webkit-scrollbar-thumb:hover {
  background: #555;
}

.message-wrapper {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.message-wrapper::before { /* Avatar */
  content: '';
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 60%;
}

.message-user::before {
  background-color: #3D3D42;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23E5E5E6'%3E%3Cpath d='M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z'/%3E%3C/svg%3E");
}

.message-ai::before {
  background-color: var(--accent-blue);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-4-4 1.41-1.41L10 14.17l6.59-6.59L18 9l-8 8z'/%3E%3C/svg%3E");
}

.message-content {
  padding-top: 5px;
  line-height: 1.75;
  word-wrap: break-word;
}

.message-user .message-content {
  background-color: var(--user-message-bg);
  padding: 0.8rem 1.2rem;
  border-radius: 12px;
}

.message-content p {
  white-space: pre-wrap;
}

/* --- Chat Footer & Form --- */
.chat-footer {
  padding: 1rem 1rem 2rem;
  background: linear-gradient(to top, var(--background-body) 50%, rgba(23, 23, 26, 0));
  flex-shrink: 0; /* Prevent footer from shrinking */
  width: 100%;
}

.input-container {
  position: relative;
  display: flex;
  align-items: flex-end;
  max-width: 820px;
  margin: 0 auto;
  background-color: var(--background-input);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 0.5rem 0.5rem 0.5rem 1rem;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.message-input {
  flex-grow: 1;
  border: none;
  outline: none;
  font-size: 1rem;
  line-height: 1.5;
  background: transparent;
  resize: none;
  max-height: 250px;
  color: var(--text-primary);
  font-family: inherit;
}

.message-input::placeholder {
  color: var(--text-secondary);
}

.send-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background-color: var(--accent-blue);
  color: white;
  cursor: pointer;
  transition: background-color 0.2s;
  flex-shrink: 0;
  margin-left: 0.5rem;
}

.send-button:disabled {
  background-color: #2E3B4E;
  color: #6a7889;
  cursor: not-allowed;
}